package cn.cheegon.blog.common.exception;


import cn.cheegon.blog.common.api.IErrorCode;

/**
 * @Desc:
 * @Author: cheegon
 * @Date: Create in 2024/6/7  下午2:03
 */
public class Asserts {
    public static void fail(String message) {
        throw new ApiException(message);
    }

    public static void fail(IErrorCode errorCode) {
        throw new ApiException(errorCode);
    }


    public static void fail(long code, String message) {
        throw new ApiException(new IErrorCode() {
            @Override
            public long getCode() {
                return code;
            }

            @Override
            public String getMessage() {
                return message;
            }
        });
    }
}
